package com.svse.designPattern.behaviour.memento;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Date 2020/8/9 10:04
 */
public class Test {
    public static void main(String[] args) {
        Originator originator = new Originator();
        Caretaker caretaker = new Caretaker();
        originator.setState("easy");
        System.out.println("初始状态：："+originator.getState());
        //保存状态
        caretaker.setMemento(originator.createMemento());
        originator.setState("hard");
        System.out.println("新的状态:："+originator.getState());
        ////恢复状态
        originator.restoreMemento(caretaker.getMemento());
        System.out.println("恢复状态:："+originator.getState());
    }
}
